
/*================================================================================*/
/* FIGURES AND TABLES IN APPENDIX */
/* Date: 12 June 2023 */
/* Eventstudy3 is exactly the same as eventstudy3 but has removed all log files   */
/* automatically created by the eventstudy3 command */
/*================================================================================*/

global raw "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/RAW/"
global result "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/RESULTS/"

cd "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/DATA/"

log using "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/RESULTS/4_appendix.log", replace
/*==============================================================================*/
/* Figure A1. Google Trend Statistics */  
/*==============================================================================*/

clear 
import excel "${raw}Paris Agreement.xlsx", sheet("ParisAgreement") firstrow allstring

gen GoogleTrend = regexs(4) if regexm(CategoryAllcategories, "^([0-9]+)[-]([0-9]+)[-]([0-9]+)[,]([0-9]+)")

destring GoogleTrend, replace force
drop in 1/2

gen Year = regexs(1) if regexm(CategoryAllcategories, "^([0-9]+)[-]([0-9]+)[-]([0-9]+)[,]([0-9]+)")
gen Month = regexs(2) if regexm(CategoryAllcategories, "^([0-9]+)[-]([0-9]+)[-]([0-9]+)[,]([0-9]+)")
gen Day = regexs(3) if regexm(CategoryAllcategories, "^([0-9]+)[-]([0-9]+)[-]([0-9]+)[,]([0-9]+)")

gen Date = mdy(real(Month), real(Day), real(Year))
gen Date2 = Date
format Date %td

twoway line GoogleTrend Date, lcolor(black) graphregion(color(white)) ///
ytitle("Google trends") xtitle("") ///
xscale(range(20089 20840)) ///
xlabel(20089 "1 Jan 2015" 20240 "1 Jul 2015" 20453 "1 Jan 2016" 20635 "1 July 2016" 20820 "1 Jan 2017") ///
text(90 20435 "Paris Agreement" 65 20561 "Signing Ceremony PA" 55 20680 "Threshold for entry" 100 20700 "PA enters into force") ///
text(85 20435 "13-19 Dec. 2015" 60 20561 "22 April 2016" 50 20680 "5 Oct. 2016" 95 20700 "4 Nov. 2016")

graph export "${result}FigA1.pdf", replace

/*==============================================================================*/
/* Figure C1. Distribution of Green revenue shares across US firms with a GR>0 between 2009-2013 (N=249) */
/*==============================================================================*/

use "${raw}Trucost_MASTER_EventStudy.dta", clear

hist  MinGRShareTotalNonNeg if XT10_US_MinGRShareTotalNonNeg!=. & Year==2013, ///
percent xtitle("Green revenue shares of firms") ytitle ("Percent") ///
graphregion(color(white)) color(blue)

graph export "${result}FigC1.pdf", replace

/*==============================================================================*/
/* Table C1. Descriptive statistics */
/*==============================================================================*/

// Daily returns for green firms

clear
import excel "${raw}US_MinGR_top8Xtile.xlsx" , sheet("Sheet2") cellrange(A4:HM73) firstrow allstring clear

rename (E-HM) var`i'#, addnumber(1)
rename C isincode
drop if missing(isincode)
duplicates drop isincode, force
foreach v of var (var1-var217) {
    local lbl : var label `v'
	
    local lbl = strtoname("`lbl'")
	
    rename `v' `v'`lbl'
}
destring (var1__5_1_2015-var217_2_29_2016), replace force


reshape long var`i', i(isincode) j(fyr, string)
save var`i', replace

rename var Price_unadjusted

gen TradingDay = regexs(1) if regexm(fyr, "^([0-9]+)_")
destring TradingDay, replace

gen DateOld = regexs(2) if regexm(fyr, "^([0-9]+)[_]+([0-9]+[_][0-9]+[_][0-9]+)")

generate Date = date(Date, "MDY")
format %td Date

bysort ISIN (TradingDay): gen Return_Unadj = ln(Price_unadjusted[_n]/Price_unadjusted[_n-1])

replace Return_Unadj =  Return_Unadj*100 

sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015), d 
sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015)

// Daily returns for emission intensive firms scope 1

clear
import excel "${raw}Trucost_US_top10pcCISc1.xlsx", sheet("Sheet2") cellrange(A4:HM111) firstrow allstring 

rename (E-HM) var`i'#, addnumber(1)
rename C isincode
drop if missing(isincode)
duplicates drop isincode, force
foreach v of var (var1-var217) {
    local lbl : var label `v'
	
    local lbl = strtoname("`lbl'")
	
    rename `v' `v'`lbl'
}
destring (var1__5_1_2015-var217_2_29_2016), replace force

reshape long var`i', i(isincode) j(fyr, string)
save var`i', replace

rename var Price_unadjusted

gen TradingDay = regexs(1) if regexm(fyr, "^([0-9]+)_")
destring TradingDay, replace

gen DateOld = regexs(2) if regexm(fyr, "^([0-9]+)[_]+([0-9]+[_][0-9]+[_][0-9]+)")

generate Date = date(Date, "MDY")
format %td Date

bysort ISIN (TradingDay): gen Return_Unadj = ln(Price_unadjusted[_n]/Price_unadjusted[_n-1])

replace Return_Unadj =  Return_Unadj*100 

sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015), d 
sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015)

// Daily returns for emission intensive firms scope 2

clear
import excel "${raw}Trucost_US_top10pcCISc2.xlsm", sheet("Sheet2") cellrange(A4:HM110) firstrow allstring 

rename (E-HM) var`i'#, addnumber(1)
rename C isincode
drop if missing(isincode)
duplicates drop isincode, force
foreach v of var (var1-var217) {
    local lbl : var label `v'
	
    local lbl = strtoname("`lbl'")
	
    rename `v' `v'`lbl'
}
destring (var1__5_1_2015-var217_2_29_2016), replace force


reshape long var`i', i(isincode) j(fyr, string)
save var`i', replace

rename var Price_unadjusted

gen TradingDay = regexs(1) if regexm(fyr, "^([0-9]+)_")
destring TradingDay, replace

gen DateOld = regexs(2) if regexm(fyr, "^([0-9]+)[_]+([0-9]+[_][0-9]+[_][0-9]+)")

generate Date = date(Date, "MDY")
format %td Date

bysort ISIN (TradingDay): gen Return_Unadj = ln(Price_unadjusted[_n]/Price_unadjusted[_n-1])

replace Return_Unadj =  Return_Unadj*100 

sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015), d 
sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015)

// Daily returns for clean patenting firms

clear
import excel "${raw}Patents_US_top10Ratio_grant_0013.xlsx", sheet("Sheet2") cellrange(A4:HM47) firstrow allstring clear

rename (E-HM) var`i'#, addnumber(1)
rename C isincode
drop if missing(isincode)
duplicates drop isincode, force
foreach v of var (var1-var217) {
    local lbl : var label `v'
	
    local lbl = strtoname("`lbl'")
	
    rename `v' `v'`lbl'
}
destring (var1__5_1_2015-var217_2_29_2016), replace force


reshape long var`i', i(isincode) j(fyr, string)
save var`i', replace

rename var Price_unadjusted

gen TradingDay = regexs(1) if regexm(fyr, "^([0-9]+)_")
destring TradingDay, replace

gen DateOld = regexs(2) if regexm(fyr, "^([0-9]+)[_]+([0-9]+[_][0-9]+[_][0-9]+)")

generate Date = date(Date, "MDY")
format %td Date

bysort ISIN (TradingDay): gen Return_Unadj = ln(Price_unadjusted[_n]/Price_unadjusted[_n-1])

replace Return_Unadj =  Return_Unadj*100 

sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015), d 
sum Return_Unadj if Date>td(22jun2015) & Date<td(29dec2015)

// Market capitalization for green firms

import excel "${raw}Top8XtileRun.xls", sheet("Sheet1") cellrange(A4:HM219) firstrow allstring clear
drop N-HM
drop if missing(ISIN)
rename (E-M) var`i'#, addnumber(2008)
destring (var2008-var2016), replace force
drop if missing(ISIN)
reshape long var`i', i(ISIN) j(fyr, string)
rename var MarketCapUSD
rename fyr Year
destring Year, replace force

gen MarketCapmUSD = MarketCapUSD/1000 // convert to million USD 
sum MarketCapmUSD if Year==2013
sum MarketCapmUSD if Year==2013 , d

// Market capitalization emission intensive firms (scope 1)

clear
import excel "${raw}Trucost_US_top10_Sc1Run.xls", sheet("Sheet1") cellrange(A4:Q106) firstrow allstring clear
drop N-Q
drop if missing(ISIN)
rename (E-M) var`i'#, addnumber(2008)
destring (var2008-var2016), replace force
drop if missing(ISIN)
reshape long var`i', i(ISIN) j(fyr, string)
rename var MarketCapUSD
rename fyr Year
destring Year, replace force

gen MarketCapmUSD = MarketCapUSD/1000
sum MarketCapmUSD if Year==2013
sum MarketCapmUSD if Year==2013 , d

// Market capitalization for emission intensive firms (scope 2)

import excel "${raw}Trucost_US_top10_Sc2Run.xls", sheet("Sheet1") cellrange(A4:Q107) firstrow allstring clear

drop N-Q
drop if missing(ISIN)

rename (E-M) var`i'#, addnumber(2008)

destring (var2008-var2016), replace force
drop if missing(ISIN)

reshape long var`i', i(ISIN) j(fyr, string)

rename var MarketCapUSD
rename fyr Year
destring Year, replace force

// convert to million USD // 
gen MarketCapmUSD = MarketCapUSD/1000
sum MarketCapmUSD if Year==2013 , d

// Market capitalization for clean patenting firms

import excel "${raw}Patent_US_granted_Run.xls", sheet("Sheet1") cellrange(A4:Q107) firstrow allstring clear
drop N-Q
drop if missing(ISIN)
rename (E-M) var`i'#, addnumber(2008)
destring (var2008-var2016), replace force
drop if missing(ISIN)
reshape long var`i', i(ISIN) j(fyr, string)
rename var MarketCapUSD
rename fyr Year
destring Year, replace force

gen MarketCapmUSD = MarketCapUSD/1000 // convert to million USD // 
sum MarketCapmUSD if Year==2013, d
sum MarketCapmUSD if Year==2013

// 3-factor parameters

use "Market_US_MinGR_top8Xtile.dta", clear

sum MktNum if Date>td(22jun2015) & Date<td(29dec2015), d  

sum SMBNum if Date>td(22jun2015) & Date<td(29dec2015), d 

sum HMLNum if Date>td(22jun2015) & Date<td(29dec2015), d 

/*==============================================================================*/
/* Table D1. Difference in intensive green revenue margin for CAAR */
/*==============================================================================*/

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_EV2_US_MinGR_yes0913)  ///
crossfile(Cross04_EV2_US_MinGR_yes0913) ///
carfile(Car_Diag_CAR05_EV2_US_MinGR_yes0913) ///
replace 

use "Cross04_EV2_US_MinGR_yes0913", clear

sum CAR5 // mean 0.0277 sd 0.1155 N = 249
	
use "List_US_MinGR_top57Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top57Xtile, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_US_MinGR_top57Xtile)  ///
crossfile(Cross04_US_MinGR_top57Xtile) ///
carfile(Car_Diag_CAR05_US_MinGR_top57Xtile) ///
replace 

use "Cross04_US_MinGR_top57Xtile", clear

sum CAR5 // mean 0.0377 sd 0.124 N = 63
		
use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_US_MinGR_top5Xtile)  ///
crossfile(Cross04_US_MinGR_top5Xtile) ///
carfile(Car_Diag_CAR05_US_MinGR_top5Xtile) ///
replace 

use "Cross04_US_MinGR_top5Xtile", clear

sum CAR5 // mean 0.016 sd 0.0671 N = 22
	
use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_eq1)  ///
crossfile(Cross04_MinGR_eq1) ///
carfile(Car_Diag_CAR05_MinGR_eq1) ///
replace 

// GR 100% vs. GR>0
use "Cross04_MinGR_eq1.dta", clear 
sum CAR5 // mean 0.1074, sd = 0.1672, N = 51
gen group = "A"
append using "Cross04_EV2_US_MinGR_yes0913"
replace group = "B" if group==""
ttest CAR5, by(group) 

// GR 100% vs. GR 25-96%
use "Cross04_MinGR_eq1.dta", clear 
gen group = "A"
append using "Cross04_US_MinGR_top57Xtile"
replace group = "B" if group==""
ttest CAR5, by(group) 

// GR 100% vs. GR 25-42%
use "Cross04_MinGR_eq1.dta", clear 
gen group = "A"
append using "Cross04_US_MinGR_top5Xtile"
replace group = "B" if group==""
ttest CAR5, by(group) 

// Baseline 97-100% GR 

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_top8Xtile)  ///
crossfile(Cross_Car05_top8Xtile) ///
carfile(Car_Diag_CAR05_MinGR_top8Xtile) ///
replace 


// GR 97-100% vs. GR>0
use "Cross_Car05_top8Xtile.dta", clear
gen group = "A"
append using "Cross04_EV2_US_MinGR_yes0913"
replace group = "B" if group==""
ttest CAR5, by(group) 

// GR 97-100% vs. GR 25-96%
use "Cross_Car05_top8Xtile.dta", clear
gen group = "A"
append using "Cross04_US_MinGR_top57Xtile"
replace group = "B" if group==""
ttest CAR5, by(group) 

// GR 97-100% vs. GR 25-42%
use "Cross_Car05_top8Xtile.dta", clear
gen group = "A"
append using "Cross04_US_MinGR_top5Xtile"
replace group = "B" if group==""
ttest CAR5, by(group) 
 
/*================================================================================*/
/* Figure D1. Event path for green firms with 5-7th decile of GR 25-96% (N = 63)  */ 
/*================================================================================*/

use "List_US_MinGR_top57Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top57Xtile, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
garch archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top57Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top57Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_US_MinGR_top57Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top57Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top57Xtile) ///
carfile(Car_Diag_Neg_MinGR_top57Xtile) ///
aarfile(AAR_neg) ///
replace 


use "List_US_MinGR_top57Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top57Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top57Xtile) ///
carfile(Car_Diag_Post_MinGR_top57Xtile) ///
aarfile(AAR_post) ///
replace 


use "Car_Diag_Pre_MinGR_top57Xtile.dta", clear

drop if _n==10

mmerge t using "Car_Diag_Neg_MinGR_top57Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top57Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

gen CILB = CAARE - 1.96*(CAARE/NCAARECorrado_Cowan)
gen CIUB = CAARE + 1.96*(CAARE/NCAARECorrado_Cowan)

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-0.15(0.05)0.1)) ylabel(-0.15(0.05)0.1) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(0.08  -15 "Pre-negotiation") ///
text(0.08 -6 "Negotiation") ///
text(0.08 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue)

graph export "${result}FigD1.pdf", replace

/*==============================================================================*/
/* Figure D2. Trump event on baseline US */
/*==============================================================================*/

use "List_2013USBaselineTop8XtileTrump", clear

eventstudy3 ISIN Date using Returns_2013USBaselineTop8XtileTrump, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_2013USBaselineTop8XtileTrump) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_2013USBaselineTop8XtileTrump", clear

eventstudy3 ISIN Date using Returns_2013USBaselineTop8XtileTrump, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_2013USBaselineTop8XtileTrump) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_2013USBaselineTop8XtileTrump", clear

eventstudy3 ISIN Date using Returns_2013USBaselineTop8XtileTrump, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_2013USBaselineTop8XtileTrump) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 
drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Trump Election 08/11/2016") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-election") ///
text(18 -6 "Election") ///
text(18 4 "Post-election") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigD2.pdf", replace

/*==============================================================================*/
/* Figure D3: Baseline regression on EU15 */
/*==============================================================================*/

use "List_PA_EU", clear

eventstudy3 ISIN Date using Returns_PA_EU, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_PA_EU) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_PA_EU", clear

eventstudy3 ISIN Date using Returns_PA_EU, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_PA_EU) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 
 
use "List_PA_EU", clear

eventstudy3 ISIN Date using Returns_PA_EU, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_PA_EU) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear
drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigD3.pdf", replace

/*==============================================================================*/
/* Figure D4. Baseline regression on Japan */
/*==============================================================================*/

use "List_PA_JP", clear

eventstudy3 ISIN Date using Returns_PA_JP, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_PA_JP) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_PA_JP", clear

eventstudy3 ISIN Date using Returns_PA_JP, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_PA_JP) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_PA_JP", clear

eventstudy3 ISIN Date using Returns_PA_JP, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_PA_JP) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigD4.pdf", replace

/*==============================================================================*/
/* Figure D5. Baseline regression with 4th factor  */
/*==============================================================================*/

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_Gostlow) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) factor3(ls_cum) /// 
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_Gostlow) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) factor3(ls_cum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_Gostlow) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) factor3(ls_cum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 


use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 
drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigD5.pdf", replace

/*==============================================================================*/
/* Figures D6. Firms with high climate related risk measures based on median */
/*==============================================================================*/

use "List_high_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_ph_expo_ew, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_high_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_ph_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_high_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_ph_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigD6.pdf", replace

/*==============================================================================*/
/* Figures D7. Firms with low climate related risk measures based on median */
/*==============================================================================*/

use "List_low_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_ph_expo_ew, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_low_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_ph_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_low_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_ph_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 
drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigD7.pdf", replace

/*==============================================================================*/
/* Table D2. */
/*==============================================================================*/

use "List_high_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_op_expo_ew, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_eq1)  ///
crossfile(Cross04_high_op_expo_ew) ///
carfile(Car_Diag_CAR05_MinGR_eq1) ///
replace 

use "List_low_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_op_expo_ew, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_eq1)  ///
crossfile(Cross04_low_op_expo_ew) ///
carfile(Car_Diag_CAR05_MinGR_eq1) ///
replace 


use Cross04_high_op_expo_ew, clear
keep CAR5 
gen high = 1
append using Cross04_low_op_expo_ew
replace high = 0 if high==.
keep CAR5 high

ttest CAR5, by(high)


use "List_high_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_ph_expo_ew, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_eq1)  ///
crossfile(Cross04_high_ph_expo_ew) ///
carfile(Car_Diag_CAR05_MinGR_eq1) ///
replace 

use "List_low_ph_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_ph_expo_ew, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_eq1)  ///
crossfile(Cross04_low_ph_expo_ew) ///
carfile(Car_Diag_CAR05_MinGR_eq1) ///
replace 

use Cross04_high_ph_expo_ew, clear
keep CAR5 
gen high = 1
append using Cross04_low_ph_expo_ew
replace high = 0 if high==.
keep CAR5 high

ttest CAR5, by(high)

/*==============================================================================*/
/* Figure D8. Abnormal returns for most emission intensive firms in Electric SeGrvice sector */
/*==============================================================================*/

use "List_Trucost_US_top10pcCISc1_491.dta", clear

eventstudy3 ISIN Date using Returns_Trucost_US_top10pcCISc1_491, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1)  ///
diagnosticsfile(Diag_post) carfile(Car_Diag_post) ///
replace 


use "List_Trucost_US_top10pcCISc1_491.dta", clear

eventstudy3 ISIN Date using Returns_Trucost_US_top10pcCISc1_491, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_neg) carfile(Car_Diag_neg) ///
replace 


use "List_Trucost_US_top10pcCISc1_491.dta", clear

eventstudy3 ISIN Date using Returns_Trucost_US_top10pcCISc1_491, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_pre) carfile(Car_Diag_pre) ///
replace 

// merge

use "Car_Diag_pre.dta", clear

drop if _n==10

mmerge t using "Car_Diag_neg", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_post", type(1:1) missing(nomatch)


gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -10 if CILB<-10
replace CILB90 = -10 if CILB90<-10
replace CIUB = 20 if CIUB > 20
replace CIUB90 = 20 if CIUB90>20

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum

graph export "${result}FigD8.pdf", replace

/*==============================================================================*/
/* Figure D9. Abnormal returns for greenest firms in Electric Services sector */
/*==============================================================================*/

use "List_US_MinGR_top8Xtile_ONLY491", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_ONLY491, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1)  ///
diagnosticsfile(Diag_POST_MinGR_yes0913) carfile(Car_Diag_POST_MinGR_yes0913) ///
replace 

use "List_US_MinGR_top8Xtile_ONLY491", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_ONLY491, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_yes0913) carfile(Car_Diag_Neg_MinGR_yes0913) ///
replace 

use "List_US_MinGR_top8Xtile_ONLY491", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_ONLY491, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_PRE_MinGR_yes0913) carfile(Car_Diag_PRE_MinGR_yes0913) ///
replace 

// merge

use "Car_Diag_PRE_MinGR_yes0913", clear

drop if _n==10

mmerge t using "Car_Diag_Neg_MinGR_yes0913", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_POST_MinGR_yes0913", type(1:1) missing(nomatch)


gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -30 if CILB<-30
replace CILB90 = -30 if CILB90<-30
replace CIUB = 30 if CIUB > 30
replace CIUB90 = 30 if CIUB90>30

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(10)20)) ylabel(-30(10)30) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(27 -15 "Pre-negotiation") ///
text(27 -6 "Negotiation") ///
text(27 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum

graph export "${result}FigD9.pdf", replace

/*==============================================================================*/
/* Figures E1a. Results with 5-day CAARs for top 30% green firms */ 
/*==============================================================================*/

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_top8Xtile)  ///
crossfile(Cross_Car05_top8Xtile) ///
carfile(Car_Diag_CAR05_MinGR_top8Xtile) ///
replace 

use "Car_Diag_CAR05_MinGR_top8Xtile.dta", clear

drop in 7/10

replace CAARE = CAARE * 100

gen tNum = _n
order tNum, after(t)

 // Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

* 90% Corrado CI
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum
twoway scatter CAARE tNum, mcolor(red) msize(2) ///
ylabel(-20(10)20) ///
xlabel(1 "[-20,15)" 2 "[-15,10)" 3 "[-10,-5)" 4 "[-5,0)" 5 "[0,5)" 6 "[5,10)") ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(2.5, lcolor(black)) xline(4.5, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 1.5 "Pre-negotiation") ///
text(18 3.5 "Negotiation") ///
text(18 5.5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum 

graph export "${result}FigE1a.pdf", replace

/*==============================================================================*/
/* Figure E1b. Results with 5-day CAARs for top 100% green firms */ 
/*==============================================================================*/

use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_eq1)  ///
crossfile(Cross_Car05_MinGR_eq1) ///
carfile(Car_Diag_CAR05_MinGR_eq1) ///
replace 

use "Car_Diag_CAR05_MinGR_eq1.dta", clear

drop in 7/10

replace CAARE = CAARE * 100

gen tNum = _n
order tNum, after(t)

 // Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

* 90% Corrado CI
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum
twoway scatter CAARE tNum, mcolor(red) msize(2) ///
ylabel(-20(10)20) ///
xlabel(1 "[-20,15)" 2 "[-15,10)" 3 "[-10,-5)" 4 "[-5,0)" 5 "[0,5)" 6 "[5,10)") ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(2.5, lcolor(black)) xline(4.5, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 1.5 "Pre-negotiation") ///
text(18 3.5 "Negotiation") ///
text(18 5.5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum 

graph export "${result}FigE1b.pdf", replace

/*==============================================================================*/
/* Figure E1c. Results with 5-day CAARs for top 40% green firms */ 
/*==============================================================================*/

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_top40pc)  ///
crossfile(Cross_Car05_MinGR_top40pc) ///
carfile(Car_Diag_CAR05_MinGR_top40pc) ///
replace 

use "Car_Diag_CAR05_MinGR_top40pc.dta", clear

drop in 7/10

replace CAARE = CAARE * 100

gen tNum = _n
order tNum, after(t)

 // Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

* 90% Corrado CI
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum
twoway scatter CAARE tNum, mcolor(red) msize(2) ///
ylabel(-20(10)20) ///
xlabel(1 "[-20,15)" 2 "[-15,10)" 3 "[-10,-5)" 4 "[-5,0)" 5 "[0,5)" 6 "[5,10)") ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(2.5, lcolor(black)) xline(4.5, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 1.5 "Pre-negotiation") ///
text(18 3.5 "Negotiation") ///
text(18 5.5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum 

graph export "${result}FigE1c.pdf", replace

/*==============================================================================*/
/* Figure E1d. Results with 5-day CAARs for median green firms */ 
/*==============================================================================*/

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_CAR05_MinGR_top5Xtile)  ///
crossfile(Cross_Car05_MinGR_top5Xtile) ///
carfile(Car_Diag_CAR05_MinGR_top5Xtile) ///
replace 

use "Car_Diag_CAR05_MinGR_top5Xtile.dta", clear

drop in 7/10

replace CAARE = CAARE * 100

gen tNum = _n
order tNum, after(t)

 // Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

* 90% Corrado CI
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum
twoway scatter CAARE tNum, mcolor(red) msize(2) ///
ylabel(-20(10)20) ///
xlabel(1 "[-20,15)" 2 "[-15,10)" 3 "[-10,-5)" 4 "[-5,0)" 5 "[0,5)" 6 "[5,10)") ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(2.5, lcolor(black)) xline(4.5, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 1.5 "Pre-negotiation") ///
text(18 3.5 "Negotiation") ///
text(18 5.5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum 

graph export "${result}FigE1d.pdf", replace

/*==============================================================================*/
/* Figure E1e. Results with 5-day CAARs for any green revenue firms */ 
/*==============================================================================*/

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_EV2_US_MinGR_yes0913)  ///
crossfile(Cross_EV2_US_MinGR_yes0913) ///
carfile(Car_EV2_US_MinGR_yes0913) ///
replace 

use "Car_EV2_US_MinGR_yes0913", clear

drop in 7/10

replace CAARE = CAARE * 100

gen tNum = _n
order tNum, after(t)

 // Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

* 90% Corrado CI
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum
twoway scatter CAARE tNum, mcolor(red) msize(2) ///
ylabel(-20(10)20) ///
xlabel(1 "[-20,15)" 2 "[-15,10)" 3 "[-10,-5)" 4 "[-5,0)" 5 "[0,5)" 6 "[5,10)") ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(2.5, lcolor(black)) xline(4.5, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 1.5 "Pre-negotiation") ///
text(18 3.5 "Negotiation") ///
text(18 5.5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum 

graph export "${result}FigE1e.pdf", replace

/*==============================================================================*/
/* Figure E1f. Results with 5-day CAARs for top 30% green firms excluding SIC491 */ 
/*==============================================================================*/

use "List_US_MinGR_top8Xtile_Excl491", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-20) car1UB(-16) ///
car2LB(-15) car2UB(-11) ///
car3LB(-10) car3UB(-6) ///
car4LB(-5) car4UB(-1) ///
car5LB(0) car5UB(5) ///
car6LB(6) car6UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_US_MinGR_top8Xtile_Excl491)  ///
crossfile(Cross_US_MinGR_top8Xtile_Excl491) ///
carfile(Car_US_MinGR_top8Xtile_Excl491) ///
replace 

use "Car_US_MinGR_top8Xtile_Excl491", clear

drop in 7/10

replace CAARE = CAARE * 100

gen tNum = _n
order tNum, after(t)

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 20 if CIUB>20

// 90% Corrado CI
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB90 = -20 if CILB90<-20
replace CIUB90 = 20 if CIUB90>20

sort tNum
twoway scatter CAARE tNum, mcolor(red) msize(2) ///
ylabel(-20(10)20) ///
xlabel(1 "[-20,15)" 2 "[-15,10)" 3 "[-10,-5)" 4 "[-5,0)" 5 "[0,5)" 6 "[5,10)") ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(2.5, lcolor(black)) xline(4.5, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 1.5 "Pre-negotiation") ///
text(18 3.5 "Negotiation") ///
text(18 5.5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum 

graph export "${result}FigE1f.pdf", replace

/*==============================================================================*/
/* Figure E2. Abnormal returns for top 30% green firms excluding Electricity Generation */
// Excluding SIC 491 
/*==============================================================================*/

use "List_US_MinGR_top8Xtile_Excl491.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile_Excl491) carfile(Car_Diag_Post_MinGR_top8Xtile_Excl491) ///
replace 

use "List_US_MinGR_top8Xtile_Excl491.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Negot_MinGR_top8Xtile_Excl491) carfile(Car_Diag_Negot_MinGR_top8Xtile_Excl491) ///
replace 

use "List_US_MinGR_top8Xtile_Excl491.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGR_top8Xtile_Excl491) carfile(Car_Diag_Pre_MinGR_top8Xtile_Excl491) ///
replace 

// merge dataset

use "Car_Diag_Pre_MinGR_top8Xtile_Excl491.dta", clear

drop if _n==10

mmerge t using "Car_Diag_Negot_MinGR_top8Xtile_Excl491", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile_Excl491", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -5 if CILB<-5
replace CILB90 = -5 if CILB90<-5
replace CIUB = 20 if CIUB > 20
replace CIUB90 = 20 if CIUB90>20

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-5(5)20)) ylabel(-5(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum

graph export "${result}FigE2.pdf", replace

/*==============================================================================*/
/* Figure E3. Event path for green firms excluding public utilities SIC 49 */ 
/*==============================================================================*/

use "List_US_MinGR_top8Xtile_Excl49.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl49, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile_Excl49) carfile(Car_Diag_Post_MinGR_top8Xtile_Excl49) ///
replace 

use "List_US_MinGR_top8Xtile_Excl49.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl49, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Negot_MinGR_top8Xtile_Excl49) carfile(Car_Diag_Negot_MinGR_top8Xtile_Excl49) ///
replace 


use "List_US_MinGR_top8Xtile_Excl49.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl49, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGR_top8Xtile_Excl49) carfile(Car_Diag_Pre_MinGR_top8Xtile_Excl49) ///
replace 

use "Car_Diag_Pre_MinGR_top8Xtile_Excl49", clear

drop if _n==10

mmerge t using "Car_Diag_Negot_MinGR_top8Xtile_Excl49", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile_Excl49", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

replace CIUB = 30 if CIUB>30
replace CILB = -10 if CILB<-10
replace CIUB90 = 30 if CIUB90>30
replace CILB90 = -10 if CILB90<-10

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(10)30)) ylabel(-10(10)30) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) ///
|| rcap CILB90 CIUB90 tNum

graph export "${result}FigE3.pdf", replace

/*==============================================================================*/
/* Figures E4a, E5a, E6a : Results for BMP, KP test statistics and AARs */
/* Top 30% */
/*==============================================================================*/

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
garch archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR_pre) ///
replace 

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_US_MinGR_top8Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

replace CILB_BMP = -10 if CILB_BMP<-10
replace CIUB_BMP = 20 if CIUB_BMP>20

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_BMP CIUB_BMP tNum, lcolor(blue) 

graph export "${result}FigE4a.pdf", replace
// This is different

use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 
drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 30 if CIUB>30

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

replace CILB_KP = -20 if CILB_KP<-20
replace CIUB_KP = 20 if CIUB_KP>20

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-20(5)20)) ylabel(-20(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_KP CIUB_KP tNum, lcolor(blue) 

graph export "${result}FigE5a.pdf", replace

use "AAR_pre.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "AAR_neg.dta", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "AAR_post.dta", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

replace AARE = AARE * 100

// Corrado-Cowan CIs
gen CILB = AARE - 1.96*(abs(AARE/NAARECorrado))
gen CIUB = AARE + 1.96*(abs(AARE/NAARECorrado))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

twoway line AARE t, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("AAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB t, lcolor(blue) 

graph export "${result}FigE6a.pdf", replace

/*==============================================================================*/
/* Figures E4b, E5b and E6b. 100% GR */ 
/*==============================================================================*/

use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
garch archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_eq1) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_eq1) /// output cumulative average abnormal return file
aarfile(AAR_pre) ///
replace 


use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_eq1) ///
carfile(Car_Diag_Neg_MinGR_eq1) ///
aarfile(AAR_neg) ///
replace 

use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_eq1) ///
carfile(Car_Diag_Post_MinGR_eq1) ///
aarfile(AAR_post) ///
replace 


use "Car_Diag_Pre_MinGR_eq1.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Negot_MinGR_eq1", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_eq1", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

replace CILB_BMP=-10 if CILB_BMP<-10 
replace CIUB_BMP=20 if CIUB_BMP>20

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_BMP CIUB_BMP tNum, lcolor(blue) 

graph export "${result}FigE4b.pdf", replace


use "Car_Diag_Pre_MinGR_eq1.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Negot_MinGR_eq1", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_eq1", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 30 if CIUB>30

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

replace CILB_KP = -20 if CILB_KP<-20
replace CIUB_KP = 20 if CIUB_KP>20

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-20(5)20)) ylabel(-20(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_KP CIUB_KP tNum, lcolor(blue) 

graph export "${result}FigE5b.pdf", replace


use "aarfile.dta", clear // This is the data for the pre-negotiation period

replace AARE = AARE * 100

// Corrado-Cowan CIs
gen CILB = AARE - 1.96*(abs(AARE/NAARECorrado))
gen CIUB = AARE + 1.96*(abs(AARE/NAARECorrado))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

twoway line AARE t, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("AAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB t, lcolor(blue) 

graph export "${result}FigE6b.pdf", replace

/*==============================================================================*/
/* Figures E4c, E5c, and E6c Top 40% */ 
/*==============================================================================*/

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGRtop40pc) ///
carfile(Car_Diag_Post_MinGRtop40pc) ///
aarfile(aarfile) ///
replace 

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Negot_MinGRtop40pc) carfile(Car_Diag_Negot_MinGRtop40pc) ///
replace 

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) ///
car2LB(-13) car2UB(-11) ///
car3LB(-14) car3UB(-12) ///
car4LB(-15) car4UB(-13) ///
car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) ///
car7LB(-18) car7UB(-16) ///
car8LB(-19) car8UB(-17) ///
car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGRtop40pc) carfile(Car_Diag_Pre_MinGRtop40pc) ///
replace 


use "Car_Diag_Pre_MinGRtop40pc.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Negot_MinGRtop40pc", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGRtop40pc", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

replace CILB_BMP = -10 if CILB_BMP<-10
replace CIUB_BMP = 20 if CIUB_BMP>20

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_BMP CIUB_BMP tNum, lcolor(blue) 

graph export "${result}FigE4c.pdf", replace


use "Car_Diag_Pre_MinGRtop40pc.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Negot_MinGRtop40pc", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGRtop40pc", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 20 if CIUB>20

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

replace CILB_KP = -20 if CILB_KP<-20
replace CIUB_KP = 20 if CIUB_KP>20

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-20(5)20)) ylabel(-20(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_KP CIUB_KP tNum, lcolor(blue) 

graph export "${result}FigE5c.pdf", replace

use "aarfile.dta", clear 

replace AARE = AARE * 100

// Corrado-Cowan CIs
gen CILB = AARE - 1.96*(abs(AARE/NAARECorrado))
gen CIUB = AARE + 1.96*(abs(AARE/NAARECorrado))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

twoway line AARE t, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("AAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB t, lcolor(blue) 

graph export "${result}FigE6c.pdf", replace

/*==============================================================================*/
/* Figures E4d, E5d, and E6d. Median */ 
/*==============================================================================*/

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top5Xtile) ///
crossfile(Cross_Post_MinGR_top5Xtile) ///
carfile(Car_Diag_Post_MinGR_top5Xtile) ///
aarfile(aarfile) ///
replace 

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top5Xtile) crossfile(Cross_Neg_MinGR_top5Xtile) carfile(Car_Diag_Neg_MinGR_top5Xtile) ///
replace

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) ///
car2LB(-13) car2UB(-11) ///
car3LB(-14) car3UB(-12) ///
car4LB(-15) car4UB(-13) ///
car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) ///
car7LB(-18) car7UB(-16) ///
car8LB(-19) car8UB(-17) ///
car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGR_top5Xtile) crossfile(Cross_Pre_MinGR_top5Xtile) carfile(Car_Diag_Pre_MinGR_top5Xtile) ///
replace 

use "Car_Diag_Pre_MinGR_top5Xtile.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top5Xtile", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top5Xtile", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

replace CILB_BMP = -10 if CILB_BMP<-10
replace CIUB_BMP = 20 if CIUB_BMP>20


sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_BMP CIUB_BMP tNum, lcolor(blue) 

graph export "${result}FigE4d.pdf", replace


use "Car_Diag_Pre_MinGR_top5Xtile.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top5Xtile", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top5Xtile", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 30 if CIUB>30

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

replace CILB_KP = -20 if CILB_KP<-20
replace CIUB_KP = 20 if CIUB_KP>20

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-20(5)20)) ylabel(-20(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_KP CIUB_KP tNum, lcolor(blue) 

graph export "${result}FigE5d.pdf", replace

use "aarfile.dta", clear 

replace AARE = AARE * 100

// Corrado-Cowan CIs
gen CILB = AARE - 1.96*(abs(AARE/NAARECorrado))
gen CIUB = AARE + 1.96*(abs(AARE/NAARECorrado))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

twoway line AARE t, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("AAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB t, lcolor(blue) 

graph export "${result}FigE6d.pdf", replace

/*==============================================================================*/
/* Figures E4e, E5e, and E6e. Any green between 2009-2013 */ 
/*==============================================================================*/

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1)  ///
diagnosticsfile(Diag_POST_MinGR_yes0913) carfile(Car_Diag_POST_MinGR_yes0913) ///
aarfile(aarfile) ///
replace 

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_yes0913) carfile(Car_Diag_Neg_MinGR_yes0913) ///
replace 

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_PRE_MinGR_yes0913) carfile(Car_Diag_PRE_MinGR_yes0913) ///
replace 


use "Car_Diag_PRE_MinGR_yes0913.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_yes0913", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_POST_MinGR_yes0913", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 10 if CIUB>10

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

replace CILB_BMP = -10 if CILB_BMP<-10
replace CIUB_BMP = 10 if CIUB_BMP>10

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)10)) ylabel(-10(5)10) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(8 -15 "Pre-negotiation") ///
text(8 -6 "Negotiation") ///
text(8 5 "Post-negotiation") ///
|| rcap CILB_BMP CIUB_BMP tNum, lcolor(blue) 

graph export "${result}FigE4e.pdf", replace

use "Car_Diag_PRE_MinGR_yes0913.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_yes0913", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_POST_MinGR_yes0913", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 30 if CIUB>30

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

replace CILB_KP = -20 if CILB_KP<-20
replace CIUB_KP = 20 if CIUB_KP>20

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-20(5)20)) ylabel(-20(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_KP CIUB_KP tNum, lcolor(blue) 

graph export "${result}FigE5e.pdf", replace

use "aarfile.dta", clear 

replace AARE = AARE * 100

// Corrado-Cowan CIs
gen CILB = AARE - 1.96*(abs(AARE/NAARECorrado))
gen CIUB = AARE + 1.96*(abs(AARE/NAARECorrado))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

twoway line AARE t, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("AAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB t, lcolor(blue) 

graph export "${result}FigE6e.pdf", replace

/*==============================================================================*/
/* Figures E4f, E5f and E6f. Top 30% excluding SIC 491 */ 
/*==============================================================================*/

use "List_US_MinGR_top8Xtile_Excl491.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile_Excl491) carfile(Car_Diag_Post_MinGR_top8Xtile_Excl491) ///
aarfile(aarfile) ///
replace 

use "List_US_MinGR_top8Xtile_Excl491.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Negot_MinGR_top8Xtile_Excl491) carfile(Car_Diag_Negot_MinGR_top8Xtile_Excl491) ///
replace 

use "List_US_MinGR_top8Xtile_Excl491.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile_Excl491, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGR_top8Xtile_Excl491) carfile(Car_Diag_Pre_MinGR_top8Xtile_Excl491) ///
replace 


use "Car_Diag_Pre_MinGR_top8Xtile_Excl491.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Negot_MinGR_top8Xtile_Excl491", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile_Excl491", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

replace CILB_BMP = -10 if CILB_BMP<-10
replace CIUB_BMP = 10 if CIUB_BMP>10

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)10)) ylabel(-10(5)10) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(8 -15 "Pre-negotiation") ///
text(8 -6 "Negotiation") ///
text(8 5 "Post-negotiation") ///
|| rcap CILB_BMP CIUB_BMP tNum, lcolor(blue) 

graph export "${result}FigE4f.pdf", replace

use "Car_Diag_Pre_MinGR_top8Xtile_Excl491.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Negot_MinGR_top8Xtile_Excl491", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_POST_MinGR_top8Xtile_Excl491", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -20 if CILB<-20
replace CIUB = 20 if CIUB>20

/// KP-Confidence Intervalls
gen CILB_KP = CAARE - 1.96*(abs(CAARE/NCAAREKolari))
gen CIUB_KP = CAARE + 1.96*(abs(CAARE/NCAAREKolari))

replace CILB_KP = -20 if CILB_KP<-20
replace CIUB_KP = 20 if CIUB_KP>20

// BMP Test
gen CILB_BMP = CAARE - 1.96*(abs(CAARE/NCAAREBoehmer))
gen CIUB_BMP = CAARE + 1.96*(abs(CAARE/NCAAREBoehmer))

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-20(5)20)) ylabel(-20(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB_KP CIUB_KP tNum, lcolor(blue) 

graph export "${result}FigE5f.pdf", replace

use "aarfile.dta", clear 

replace AARE = AARE * 100

// Corrado-Cowan CIs
gen CILB = AARE - 1.96*(abs(AARE/NAARECorrado))
gen CIUB = AARE + 1.96*(abs(AARE/NAARECorrado))

replace CILB = -10 if CILB<-10
replace CIUB = 10 if CIUB>10

twoway line AARE t, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)10)) ylabel(-10(5)10) xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("AAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(8 -15 "Pre-negotiation") ///
text(8 -6 "Negotiation") ///
text(8 5 "Post-negotiation") ///
|| rcap CILB CIUB t, lcolor(blue) 

graph export "${result}FigE6f.pdf", replace

/*==============================================================================*/
/* Figure E.7 : Random non-green firms */
/*==============================================================================*/

use "List_PA_random", clear

eventstudy3 ISIN Date using Returns_PA_random, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_PA_random", clear

eventstudy3 ISIN Date using Returns_PA_random, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 

use "List_PA_random", clear

eventstudy3 ISIN Date using Returns_PA_random, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigE7.pdf", replace

/*==============================================================================*/
/* Figure E8. Regression with value weighted */
/*==============================================================================*/

use "List_US_MinGR_top8Xtile", clear

eventstudy3 ISIN Date using Return_US_MinGR_top8Xtile_weighted, returns(Return_w_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile_w) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile_w) /// output cumulative average abnormal return file
aarfile(AAR_w) ///
replace 

use "List_US_MinGR_top8Xtile", clear

eventstudy3 ISIN Date using Return_US_MinGR_top8Xtile_weighted, returns(Return_w_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile_w) /// 
carfile(Car_Diag_Neg_MinGR_top8Xtile_w) ///
aarfile(AAR_neg_w) ///
replace

use "List_US_MinGR_top8Xtile", clear

eventstudy3 ISIN Date using Return_US_MinGR_top8Xtile_weighted, returns(Return_w_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile_w) ///
carfile(Car_Diag_Post_MinGR_top8Xtile_w) ///
aarfile(AAR_post_w) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile_w.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile_w", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile_w", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}FigE8.pdf", replace

/*==============================================================================*/
/* Figure E9. DID high green vs dirty */
/*==============================================================================*/

use "did_gr97_100", clear
append using "did_scope1and2"

// remove duplicates: firms that are both green and dirty
duplicates tag ISIN Date, gen(x)
drop if x==1

egen group = group(ISIN)
tsset group Date
tsfill
gen gap = (ISIN=="")
gen day = dow(Date)
drop if day==0 | day==6

bys group: replace green = green[_n-1] if green==.
bys group: replace ISIN = ISIN[_n-1] if ISIN==""
bys group: replace Return = Return[_n-1] if Return==.

gen PA = date("December 14, 2015", "MDY")
format  PA %d

gen post = (Date>PA)
gen post_green = post * green

sort Date
gen time = . 
replace time = 0 if Date==PA
bys ISIN (Date): replace time = time[_n-1] + 1 if time==.

gsort ISIN -Date
replace time = time[_n-1] - 1 if time==.

gen time_1 = (time == 0)
gen time_2 = (time == 1)
gen time_3 = (time == 2)
gen time_4 = (time == 3)
gen time_5 = (time == 4)
gen time_6 = (time == 5)
gen time_7 = (time == 6)
gen time_8 = (time == 7)
gen time_9 = (time == 8)
gen time_10 = (time == 9)

gen time1 = (time == -2)
gen time2 = (time == -3)
gen time3 = (time == -4)
gen time4 = (time == -5)
gen time5 = (time == -6)
gen time6 = (time == -7)
gen time7 = (time == -8)
gen time8 = (time == -9)
gen time9 = (time == -10)
gen time10 = (time == -11)

gen time_1_t = (time == 0 & green ==1)
gen time_2_t = (time == 1 & green ==1)
gen time_3_t = (time == 2 & green ==1)
gen time_4_t = (time == 3 & green ==1)
gen time_5_t = (time == 4 & green ==1)
gen time_6_t = (time == 5 & green ==1)
gen time_7_t = (time == 6 & green ==1)
gen time_8_t = (time == 7 & green ==1)
gen time_9_t = (time == 8 & green ==1)
gen time_10_t = (time == 9 & green ==1)

gen time1_t = (time == -2 & green ==1)
gen time2_t = (time == -3 & green ==1)
gen time3_t = (time == -4 & green ==1)
gen time4_t = (time == -5 & green ==1)
gen time5_t = (time == -6 & green ==1)
gen time6_t = (time == -7 & green ==1)
gen time7_t = (time == -8 & green ==1)
gen time8_t = (time == -9 & green ==1)
gen time9_t = (time == -10 & green ==1)
gen time10_t = (time == -11 & green ==1)

rename time date_time

xi: reg Return time*
parmest, format(estimate min95 max95) list(,) saving(dyn.dta, replace) 

use dyn, clear

drop if parm=="_cons"
keep if _n>=21
gen time = subinstr(parm, "time", "", .)
replace time = subinstr(time, "_t", "", .)
replace time = subinstr(time, "_", "", .)
destring time, replace
replace time = time*-1 if _n>=11 
set obs 21
replace time = 0 in 21
replace estimate = 0 in 21
replace min95 = 0 in 21
replace max95 = 0 in 21

sort time

twoway (line estimate time, lcolor(red)) || (rcap min95 max95 time, lcolor(black) xline(0, lcolor(red)) yline(0, lcolor(black)) ///
graphregion(color(white)) legend(off)  ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("Difference in Returns"))

graph export "${result}FigE9.pdf", replace


/*==============================================================================*/
/* Figure E10. DID 97-100% vs. 25-42% */
/*==============================================================================*/

use "did_gr25_42", clear
append using "did_gr97_100"

egen group = group(ISIN)
tsset group Date
tsfill
gen gap = (ISIN=="")
gen day = dow(Date)
drop if day==0 | day==6

bys group: replace green = green[_n-1] if green==.
bys group: replace ISIN = ISIN[_n-1] if ISIN==""
bys group: replace Return = Return[_n-1] if Return==.


gen PA = date("December 14, 2015", "MDY")
format  PA %d

gen post = (Date>PA)
gen post_green = post * green

sort Date
gen time = . 
replace time = 0 if Date==PA
bys ISIN (Date): replace time = time[_n-1] + 1 if time==.

gsort ISIN -Date
replace time = time[_n-1] - 1 if time==.

gen time_1 = (time == 0)
gen time_2 = (time == 1)
gen time_3 = (time == 2)
gen time_4 = (time == 3)
gen time_5 = (time == 4)
gen time_6 = (time == 5)
gen time_7 = (time == 6)
gen time_8 = (time == 7)
gen time_9 = (time == 8)
gen time_10 = (time == 9)

gen time1 = (time == -2)
gen time2 = (time == -3)
gen time3 = (time == -4)
gen time4 = (time == -5)
gen time5 = (time == -6)
gen time6 = (time == -7)
gen time7 = (time == -8)
gen time8 = (time == -9)
gen time9 = (time == -10)
gen time10 = (time == -11)

gen time_1_t = (time == 0 & green ==1)
gen time_2_t = (time == 1 & green ==1)
gen time_3_t = (time == 2 & green ==1)
gen time_4_t = (time == 3 & green ==1)
gen time_5_t = (time == 4 & green ==1)
gen time_6_t = (time == 5 & green ==1)
gen time_7_t = (time == 6 & green ==1)
gen time_8_t = (time == 7 & green ==1)
gen time_9_t = (time == 8 & green ==1)
gen time_10_t = (time == 9 & green ==1)

gen time1_t = (time == -2 & green ==1)
gen time2_t = (time == -3 & green ==1)
gen time3_t = (time == -4 & green ==1)
gen time4_t = (time == -5 & green ==1)
gen time5_t = (time == -6 & green ==1)
gen time6_t = (time == -7 & green ==1)
gen time7_t = (time == -8 & green ==1)
gen time8_t = (time == -9 & green ==1)
gen time9_t = (time == -10 & green ==1)
gen time10_t = (time == -11 & green ==1)

rename time date_time

xi: reg Return time*
parmest, format(estimate min95 max95) list(,) saving(dyn.dta, replace) 

use dyn, clear

drop if parm=="_cons"
keep if _n>=21
gen time = subinstr(parm, "time", "", .)
replace time = subinstr(time, "_t", "", .)
replace time = subinstr(time, "_", "", .)
destring time, replace
replace time = time*-1 if _n>=11 
set obs 21
replace time = 0 in 21
replace estimate = 0 in 21
replace min95 = 0 in 21
replace max95 = 0 in 21

sort time

twoway (line estimate time, lcolor(red)) || (rcap min95 max95 time, lcolor(black) xline(0, lcolor(red)) yline(0, lcolor(black)) ///
graphregion(color(white)) legend(off)  ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("Difference in Returns"))

graph export "${result}FigE10.pdf", replace

/*==============================================================================*/
/* Figure E11. DID 97-100% vs. gr0 */
/*==============================================================================*/

use "did_gr97_100", clear
append using "did_gr0"

// remove full green that are also in min0 green
duplicates tag ISIN Date, gen(x)
replace green = 1 if x==1

drop x
duplicates drop 

egen group = group(ISIN)
tsset group Date
tsfill
gen gap = (ISIN=="")
gen day = dow(Date)
drop if day==0 | day==6

bys group: replace green = green[_n-1] if green==.
bys group: replace ISIN = ISIN[_n-1] if ISIN==""
bys group: replace Return = Return[_n-1] if Return==.

gen PA = date("December 14, 2015", "MDY")
format  PA %d

gen post = (Date>PA)
gen post_green = post * green

sort Date
gen time = . 
replace time = 0 if Date==PA
bys ISIN (Date): replace time = time[_n-1] + 1 if time==.

gsort ISIN -Date
replace time = time[_n-1] - 1 if time==.

gen time_1 = (time == 0)
gen time_2 = (time == 1)
gen time_3 = (time == 2)
gen time_4 = (time == 3)
gen time_5 = (time == 4)
gen time_6 = (time == 5)
gen time_7 = (time == 6)
gen time_8 = (time == 7)
gen time_9 = (time == 8)
gen time_10 = (time == 9)

gen time1 = (time == -2)
gen time2 = (time == -3)
gen time3 = (time == -4)
gen time4 = (time == -5)
gen time5 = (time == -6)
gen time6 = (time == -7)
gen time7 = (time == -8)
gen time8 = (time == -9)
gen time9 = (time == -10)
gen time10 = (time == -11)

gen time_1_t = (time == 0 & green ==1)
gen time_2_t = (time == 1 & green ==1)
gen time_3_t = (time == 2 & green ==1)
gen time_4_t = (time == 3 & green ==1)
gen time_5_t = (time == 4 & green ==1)
gen time_6_t = (time == 5 & green ==1)
gen time_7_t = (time == 6 & green ==1)
gen time_8_t = (time == 7 & green ==1)
gen time_9_t = (time == 8 & green ==1)
gen time_10_t = (time == 9 & green ==1)

gen time1_t = (time == -2 & green ==1)
gen time2_t = (time == -3 & green ==1)
gen time3_t = (time == -4 & green ==1)
gen time4_t = (time == -5 & green ==1)
gen time5_t = (time == -6 & green ==1)
gen time6_t = (time == -7 & green ==1)
gen time7_t = (time == -8 & green ==1)
gen time8_t = (time == -9 & green ==1)
gen time9_t = (time == -10 & green ==1)
gen time10_t = (time == -11 & green ==1)

rename time date_time

xi: reg Return time*
parmest, format(estimate min95 max95) list(,) saving(dyn.dta, replace) 

use dyn, clear

drop if parm=="_cons"
keep if _n>=21
gen time = subinstr(parm, "time", "", .)
replace time = subinstr(time, "_t", "", .)
replace time = subinstr(time, "_", "", .)
destring time, replace
replace time = time*-1 if _n>=11 
set obs 21
replace time = 0 in 21
replace estimate = 0 in 21
replace min95 = 0 in 21
replace max95 = 0 in 21

sort time

twoway (line estimate time, lcolor(red)) || (rcap min95 max95 time, lcolor(black) xline(0, lcolor(red)) yline(0, lcolor(black)) ///
graphregion(color(white)) legend(off)  ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("Difference in Returns"))

graph export "${result}FigE11.pdf", replace

log close
